<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('我的分享')"/>
    <style>
        .fixed-table-toolbar {
            display: none;
        }
    </style>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>文件名称：</label>
                            <input type="text" name="fileName"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" id="search" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <!--            <div class="btn-group-sm" id="toolbar" role="group">-->
        <!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="gy:userShareDoc:add">-->
        <!--                    <i class="fa fa-plus"></i> 添加-->
        <!--                </a>-->
        <!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="gy:userShareDoc:edit">-->
        <!--                    <i class="fa fa-edit"></i> 修改-->
        <!--                </a>-->
        <!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="gy:userShareDoc:remove">-->
        <!--                    <i class="fa fa-remove"></i> 删除-->
        <!--                </a>-->
        <!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="gy:userShareDoc:export">-->
        <!--                    <i class="fa fa-download"></i> 导出-->
        <!--                </a>-->
        <!--            </div>-->
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('gy:userShareDoc:edit')}]];
    var removeFlag = [[${@permission.hasPermi('gy:userShareDoc:remove')}]];
    var userDocShare = [[${@dict.getType('user_doc_share')}]];
    var prefix = ctx + "gy/userShareDoc";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "我分享的文档",
            columns: [
                // {
                //     field: 'shareId',
                //     title: '主键',
                //     visible: true
                // },
                // {
                //     field: 'fileId',
                //     title: '文档名称'
                // },
                {
                    field: 'fileName',
                    title: '文件名称'
                },
                // {
                //     field: 'pwd',
                //     title: '文档密码'
                // },

                // {
                //     field: 'userId',
                //     title: '分享人用户id'
                // },
                // {
                //     field: 'fileExt',
                //     title: '文件的扩展名'
                // },
                // {
                //     field: 'orderByNo',
                //     title: '排序'
                // },
                // {
                //     field: 'validTime',
                //     title: '分享时间'
                // },
                // {
                //     field: 'validStr',
                //     title: '有效期'
                // },
                {
                    field: 'urlInfo',
                    title: '共享链接地址'
                },
                // {
                //     field: 'urlInfo',
                //     title: '分享的链接'
                // },
                // {
                //     field: 'validTime',
                //     title: '生效时间'
                // },
                // {
                //     field: 'userName',
                //     title: '用户名'
                // },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        if(row.recviveStatus == "1" ||row.recviveStatus == 1){
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="cancelShare(\'' + row.shareId + '\')">取消分享</a> ');
                        }
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.shareId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function cancelShare(shareId){  //取消分享
        $.modal.confirm("确定取消分享该条信息吗？", function () {
            $.operate.saveModal(prefix + "/cancelShare", {"shareId": shareId}, function () {
                $("#search").click();
            });
        });
    }
</script>
</body>
</html>
